<?php


namespace app\home\controller;

use think\Db;
use think\facade\Config;
use app\common\library\Qiniu;

class Product extends Base
{
    protected $beforeActionList = [
        'first',
    ];

    protected function first()
    {
        $this->assign('nav', 'product');
    }

    public function index()
    {
        $slide = DB::name('product')->order('c_time desc')->select();
        $this->assign('product', $slide);
        $slide = DB::name('product')->order('c_time desc')->page(1, 2)->select();
        $this->assign('product_ad', $slide);
        return view();
    }

    public function info()
    {
        $info = DB::name('product')->where('id', input('id'))->find();
        if ($info) {
            $this->assign('info',$info);
            return view();
        } else {
        $this->redirect('home/index/index');
        }

    }


}